export function formatMonthAndDay(d) {
    if (!(d instanceof Date)) {
        d = new Date(d);
    }
    let mStr = (d.getUTCMonth() + 1).toString();
    let dStr = d.getUTCDate().toString();
    if (mStr.length === 1) {
        mStr = "0" + mStr;
    }
    if (dStr.length === 1) {
        dStr = "0" + dStr;
    }
    return `${mStr}-${dStr}`;
}

const myList = [
    "周日", "周一", "周二", "周三", "周四", "周五", "周六"
];

export function dayOfWeek(d) {
    if (!(d instanceof Date)) {
        d = new Date(d);
    }
    return myList[d.getDay()];
}

export function dateTimeFormat(timeStr) {
    const time = new Date(timeStr);
    return `${time.getFullYear()}年${time.getMonth() + 1}` +
        `月${time.getDate()}日 ${time.getHours()}:` +
        `${time.getMinutes()}:${time.getSeconds()}`;
}